<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        body {
            font-family: "Helvetica", "Arial", serif;
            color: #333;
            background-color: #ccc;
            margin: 1em auto;
        }

        h1 {
            color: #333;
            background-color: transparent;
        }

        a {
            color: #c60;
            background-color: transparent;
            font-weight: bold;
            text-decoration: none;
        }

        ul {
            padding: 0;
            display: block;
            margin: 0 auto;
            width: 480px;
        }

        li {
            float: left;
            padding: 1em;
            list-style: none;
        }

        #imagegallery {

            list-style: none;
        }

        #imagegallery li {
            margin: 0px 20px 20px 0px;
            padding: 0px;
            display: inline;
        }

        #imagegallery li a img {
            border: 0;
        }
    </style>
    <!--<script type="text/javascript">
        window.onload = showImg(num);
        function showImg(num) {
            var img = document.getElementById("image");
            img.src = "images/" + num + ".jpg";
            //返回showImg();false,防止a链接的触发
            return false;
        }
        //    console.log(showImg());
    </script>-->
</head>
<body>
<center>
    <h2>
        美女画廊
    </h2>

    <!--<ul id="imagegallery">
        <li><a href="images/1.jpg" onclick="return showImg(1)" title="美女A">
            <img src="images/1-small.jpg" width="100" alt="美女1"/>
        </a></li>
        <li><a href="images/2.jpg" onclick="return showImg(2)" title="美女B">
            <img src="images/2-small.jpg" width="100" alt="美女2"/>
        </a></li>
        <li><a href="images/3.jpg" onclick="return showImg(3)" title="美女C">
            <img src="images/3-small.jpg" width="100" alt="美女3"/>
        </a></li>
        <li><a href="images/4.jpg" onclick="return showImg(4)" title="美女D">
            <img src="images/4-small.jpg" width="100" alt="美女4"/>
        </a></li>
    </ul>-->

    <ul id="imagegallery">
        <li><a href="images/1.jpg" title="美女A美女A美女A美女A美女A美女A美女A">
            <img src="images/1-small.jpg" width="100" alt="1"/>
        </a></li>
        <li><a href="images/2.jpg" title="美女B美女B美女B美女B美女B美女B">
            <img src="images/2-small.jpg" width="100" alt="2"/>
        </a></li>
        <li><a href="images/3.jpg" title="美女C美女C美女C美女C美女C美女C">
            <img src="images/3-small.jpg" width="100" alt="3"/>
        </a></li>
        <li><a href="images/4.jpg" title="美女D美女D美女D美女D美女D美女D">
            <img src="images/4-small.jpg" width="100" alt="4"/>
        </a></li>
    </ul>

    <div style="clear:both"></div>

    <img id="image" src="images/placeholder.png" alt="" width="450px"/>

    <p id="des">选择一个图片</p>
    <!--<script type="text/javascript">
        var doc = document.getElementById("imagegallery");
        var des = document.getElementById("des");
        var img = document.getElementById("image");
        var demo = doc.getElementsByTagName("a");
        for (i = 0; i < demo.length; i++) {
            var show = demo[i];
            show.onmouseover = function () {
                img.src = this.href;
                des.innerHTML=this.title;
            }
            show.onclick = function () {
                img.src = this.href;
                des.innerText=this.title;
                return false;
            }
        }
    </script>-->
    <script src="js/style.js"></script>
    <!--调用外部js-->
    <script type="text/javascript">
        var galler = document.getElementById("imagegallery");
        var demo = galler.getElementsByTagName("a");//所有小图片
        var img = document.getElementById("image");
        for (i = 0; i < demo.length; i++) {
            var imgs = demo[i];
            imgs.onmouseover = function () {
                img.src = this.href;
                setText(des, this.title);
            }
            imgs.onclick = function () {
                img.src = this.href;
                return false;
            }
        }
    </script>
</center>
</body>
</html>